Tweaked the rectangle-rotating function to not have subtle, 1-pixel rounding errors when objects are rotated by multiples of 90°.