Your not alone kuper I have the same problem artifact only appears when window is near center of screen. The artifact is a repeat of the right edge of the right corner gold.dds . Your code is crazy complex for me so id recommend you focus on the code for getting rotating and position the image.
I noticed the artifacts only happen once its past 444 x coord so had a hunch to look for 444 in code and what do u guess.
Line: 78 GUIElement_SetPosition("MainWindow",1,"",444, 283) culprit related to this im betting
A child's dream never dies.