This isn't really a code issue, its more of a wtf is this not working, I always have this problem where ui does not stay in the position I want it to (yes, I use scale and not offsets, for scale and position) I figured out how to stop it from stretching, but not moving. Problem is in pictures here -> Imgur Thanks!
From what I can see in your image you're changing the size of the screen (by screen I mean the screen which is displaying the game) and this is causing the UI to change move around the screen?
This is happening because you are using scale to define your UI (intended behaviour). If your position is set to {0,0,0,0} (and anchor point 0,0) then the box will display in the top left but if your position is set to {0.1, 0, 0.1, 0} (only the scale component has changed) then the box will display 10% of the way across your screen and 10% of the way down your screen. If you dont understand read this
If you really want the UI to stay in the same spot regardless of screen size I guess you could read from absolute position, print out the result and then manually put it into the offset component but that would not work well for different sized screens etc.
Good luck, I hope this answered your question. If you need more help please elaborate on your question.