Align the box with edge of screen

I want to align 4 boxes with the edge of the screen in any resolution with my Z location.

right now im doing it with getting line trace from the camera but it’s not totally perfect, anyone has a better solution for me?

Thanks .