Better image rotate calculations

accelerometer reading  to image rotation conversion was corrected to
more closely reflect device orientation.