#version 430 core
layout(location = 0) in vec2 aPos;
layout(location = 1) in vec2 aUV;

out vec2 vUV;

uniform vec2 uPos;
uniform vec2 uSize;
uniform vec2 uScreen;
uniform vec2 uUVMin;
uniform vec2 uUVMax;

void main()
{
    vec2 pos = uPos + aPos * uSize;
    gl_Position = vec4((pos / uScreen) * 2.0 - 1.0, 0.0, 1.0);

    // Remap UV to tile slice
    vUV = mix(uUVMin, uUVMax, aUV);
}
