# What coordinates are we passing to pixel shader from vertex shader?

I have read articles about shader programing and understood the very basic knowledge of shader programing. One thing I always get confused is about the texture mapping. What I pass(output) from VS to PS is the vertex position and Texture Coordinates. I understood that in VS we can simply choose to pass the vertex position as it is or manipulate vertex position here (and may be something more). So what we ultimately pass is the position of the vetex. But... it is still not clear to me that we are passing which we are calling as texture coordinates or UV?

If I understood correctly, if my model is a simple triangle consist of 3 vertices, VS will be run three times for each of the vertix and I am passing the position of the vertex. Its straight forward. But what is with the texture? Say, I am using 50x50 jpg image as texture. How are the 3 vertices are mapped to this 50x50 pixel texture?

From the book I have started reading couple of days ago explained that the rasterizer is the one which groups the vertices to form triangle and calculates the number of pixel in the triangle. But again its not clear to me that what we are passing as texture coordinates to VS?

Texture Coordinates are usually expressed in the range between [0,1]. Each (textured) vertex will have these coordinates. These coordinates are mapped to texels in the actual texture. [0,0] is the top left corner, [1,1] the bottom-right corner. When the coordinates are in a range that is multiple of 1, the texture will repeat itself.
For example, for a pixel halfway between v0 having t[0,0] and v1 having t[1,1], the rasterizer will interpolate the texture coordinates value, resulting in t[0.5,0.5]. The texture lookup would then sample the texel in middle of the texture.