I'm trying to figure out how to best track 2D absolute position of a device on a surface of indeterminate size. Obviously, an accelerometer or mouse sensor would work for relative position, but I want the device to be able to tell where it is on the board, not just where it is relative to where it was placed. I want a bunch of these things, so cost would ideally be under $20 or so per camera. My best idea so far is covering the surface in a four-way colour gradient, and then using a small camera (anything around 1 or 2 inches in size out there?) mounted on the bottom of the device to get colour values of whatever is immediately underneath (so resolution is irrelevant - I can deal with 1x1 pixel).

Is there anything that fits this criteria, or even better, some other way to track absolute position?