Collision calculation from mouse with world

I have a 2d plane inside JME, which the camera looks at.

The 2d plane is divided up into squares, like so:

http://imgur.com/FYYrc

Now what I want is for the user to be able to click and thus place a city or road on the square he was pointing at.



I already had the old collision detection in place, which used the camera position and camera direction to cast a ray, using the usual collision calculation.

However, since the mouse isn’t always in the middle of the camera (the camera is set to dragToRotate), I can’t use that anymore



So how do I find out which square was clicked?



Thanks in advance

Im sorry, I completely read over the tutorial which covered this



My question is anwered