2D rotation code