rotating refactor, fixing image crop when rotating with wrong orientation