Translate mouse coordinates to world coordinates

After searching for a long time I still cannot find a way to convert from the view's mouse coordinates to the opengl world coordinates. Here's what I have:

A windowed opengl view that's about 400 x 300
I draw a bunch of quads all at the same z location but different x & y locations
I want to be able to tell which quad I clicked on, I know each quads location and dimension in world coordinates, e.g. quad 1 is at -2, -2 and is 0.8 by 0.8 big.
I do glTranslatef(0.0, 0.0, -5.0f); to back off the camera from where I've drawn.

In mouseDown, get the window coordinates from the event locationInWindow
Then I grab the viewport, modelview matrix and projection matrix and call gluUnProject

The values I get back from that don't seem to make any sense. I'm guessing it's because I'm sending in 0.0 to gluUnProject for the local z coordinate which is the near plane, so I'm getting back the coordinates at the near plane.

So, am I supposed to figure out what z position to put in since I know the projection near & far planes and what z position my objects are at?

If you need the perspective view, call gluUnProject twice, passing 0.0 for z the first time and 1.0 for z the second. That gives you two points on the line in 3D space that would be transformed to the pixel that was clicked. You can then programmatically intersect that line with your geometry to find out what was hit.