If you rotate clockwise, your crop co-ordinates change like this:
x1 <- width - old_y2 - 1
x2 <- width - old_y1 - 1
y1 <- old_x1
y2 <- old_x2
If you rotate anti-clockwise, your crop co-ordinates change like this:
x1 <- old_y1
x2 <- old_y2
y1 <- height - old_x2 - 1
y2 <- height - old_x1 - 1
Note that width
and height
above are the new width and height. You can substitute those for the old height
and width
, respectively.
To work this out, all I did was draw a picture on a scrap of paper. I labelled the crop points, rotated it, and worked out how they changed.