I'm trying to texture a cube by using only one texture, but only rendering one part of it on each face.
This is the texture I wanted to use for now:

My goal is to get this done via the shaders, I'm not experienced with them yet but I'm trying my best to learn..
Here's my current fragment shader:
uniform sampler2D tex0;
void main()
{
vec2 pos = vec2(gl_TexCoord[0] / 4.0);
vec3 test = texture2D(tex0,pos).rgb;
gl_FragColor.rgb = test;
}
Obviously it's just the beginning and all of the sides are using the same part of the texture, I'm just new to shaders and I'm not even sure if this really can be done this way..
I just have no clue if it's really possible to determine which face I'm currently on and such, I thought I might be able to pass information about the vertex to the fragment shader and then act according to it?
P.S: I went for this in the first place because I want a functionality where if the cube will be resized, the texture on every side will repeat itself rather than stretch