Calculate the difference vector between the clicked position and the cubes center. Then you can examine which of the three components got the greatest absolute value and its sign.


Always learn from history, to be sure you make the same mistakes again...