Not a terribly good idea, imho. But yes it can be done, just going to be VERY slow. Unless you want to switch over to api interfaces, in which case its just slow (not very). But still implementing this is extremely tricky*.
First you have to understand that there is a separation between object and shading. A bit like semantics and style is supposed to be separated in a document. Likewise it does make little sense to select text that is bold, well huh sure its bold now but if it has a different template the same thing might be oblique instead. So what kind of texture the object has is just a result if pairing to unrelated things. and they MAY or may not be paired for long. This can have some unforeseen consequences down the line.
Second uv's are not necessarily mapped uniform in all cases, while i highly doubt the problem will happen with a checkered texture which is a special case anyway (i mean if you only ever plan to do this with a checkered texture then dont bother sampling the texture), but might occur for noises or other tetures.
Then theres the question of what color is a polygon, how do you define it? I mean is it the exact color at the middle of the polygon uv value. Fine a bit more manageable, but still fails on a slight, but terrible, gotcha. You dont know where the uv center is! See problem is that the center in uv is based on subtriangles. And that data is not necessarily set in stone. Sure the center is easy in 3d but not in the uv space. If you assume its the same as is the weighted average of face vertex uv positions you might be terribly wrong. So youd have to tessellate the polygon internally and find the actual center. Or you might just make a wild guess and get slightly deviant result form what you see on screen, youd have to forgo this anyway since different renderers do this differently. In the unfortunate case youd wanted the average over the face, yough luck cant be done for general shaders.
Then theres the shading set thing. See a shader exists on every point of a polygon object even tough it does notexist. They are bound only at very late stages you know.
So heres the outline for pseudocode.
for each face:
find what shading group the face belongs to
find the uv center (or any other search pattern of your liking)
store the uv cordinate
in one go call colorAtPoint
(suggestion use python it gets much faster if you pass all points in one call)
*so wont become a tool for general use very likely. Yes ive done it, got huge headaches form users.
PS treserve a week for this. Or get somebeody else to do it for you.