A little matrix algebra and trigonometric identities will help you solve this problem.
, , , , .
Sx ( X) Sy ( Y) :
⎡Sx 0 ⎤
⎣0 Sy⎦
, R-, :
⎡cos(R) sin(R)⎤
⎣-sin(R) cos(R)⎦
, :
⎡Sx.cos(R) Sx.sin(R)⎤
⎣-Sy.sin(R) Sy.cos(R)⎦
, , , ( , , ).
A CGAffineTransform a, b, c, d, :
⎡a b⎤
⎣c d⎦
Sx, Sy R. :
tan(A) = sin(A) / cos(A)
, , :
tan(R) = Sx.sin(R) / Sx.cos(R) = b / a and therefore R = atan(b / a)
R, , :
a = Sx.cos(R) and therefore Sx = a / cos(R)
d = Sy.cos(R) and therefore Sy = d / cos(R)
, Sx, Sy R.