Fix minor arbitrary rotation tool issues

The old code didn't properly distinguish layer vs image behavior under
certain circumstances
New Image and Layer -> Straighten tools

Thanks to PSC user ha_asgag for suggesting this tool.

Straighten is basically a specialized version of arbitrary rotation.
After rotating an image (or layer), we use trigonometry to solve for the
maximum rectangular area of the rotated image, which we then use to
auto-scale the relevant area, cropping out any dead space in the
corners.  In PD's case, we also add some guidelines during the preview
step, to help the user find the "ideal" orientation.

Thank you to
http://stackoverflow.com/questions/18865837/image-straightening-in-android
for ideas on how to go about the trigonometry; while their formula
doesn't actually work correctly, it pointed me in the right direction.