better photo scaling and rotation