Canvas Rotation Principle
Image rotation uses HTML5 Canvas API's rotate() method for coordinate system transformation. The algorithm first moves the canvas origin to the image center, applies rotation transformation, then draws the rotated image. For 90° multiples, simple coordinate swapping optimizes performance; for arbitrary angles, trigonometric calculations are required to determine new coordinates.