texel formula

Can someone please point me to where in the GLSL or OpenGL3.2 spec it is specified to which texel in a sampled texture texture coordinates (s, t, p, q) are mapped.

Start with section 3.8.9, “Texture Minification”. The rules for mipmap level determination and coordinate wrapping are spelled out there.

See also section 3.6.1 “Basic Polygon Rasterization” which describes the barycentric coordinate interpolation.