The final output should be like image(HELLO WORLD):
Here is what i am do
2 thoughts, can't test right now.
Where is 0 (x=1, y=0) or (x=0, y=1). It seems your text is off by 90 degrees which usually means that your assuming 0 is directly right, when maybe it's directly up or vice versa.
(rad2deg(atan2($delta_y,$delta_x)) * 180 / M_PI)-360;
are you doing double work here? rad2deg
converts from radians to degrees. 180 / M_PI
is also a conversion from radians to degrees.