Im working on a system where the player turns to wherever the mouse is pointing(4 directions). and for this i require the game to split the screen in 4, and detect in what spot the mouse is. I already know how i can make the game detect the mouse coordinates, but i dont know the calculation/scripting to make the game split the screen in 4 as an X. Also id like the center to be the player, even if hes not in the middle of the screen. example:

Any information or help would be appreciated. Thanks in advance!
Edit: I've found a site that seems to be on the right track on what i want: https://stackoverflow.com/questions/15994194/how-to-convert-x-y-coordinates-to-an-angle
But I dont understand how to put this into practice. it'd invaluable if someone could show me how to create a function to check in which "triangle" the mouse cursor is.