UI: Conflict between finding the center of the screen and the windows layout scale.

I made a UI to serve as the crosshair of my top-down shooter. Some elements of the mine scale according to the distance from the center of the screen. The problem that is occurring is that the scale of the windows layout (first print) is affecting the position of the center of the screen. The code I made to find the center of the screen was to take the height and width and divide by 2. It works if the windows layout scale is at 100%, but at other scales like 125% (standard on most notebooks) the calculated position of the center of the screen takes an offset. What do I do?