Simple rotation [13] fills in the destination image in raster order by point-sampling the source image. The optimization lies in the fact that the expensive matrix multiplication is done once outside the inner loop. The inner loop itself contains step additions for going from one pixel to the next (in the source image) as well as some conditional statements to check for pixels which map to positions outside the boundaries of the source image.