implementing rotation and scaling