#version 330

uniform vec2 u_viewport;
uniform vec2 u_offset;
uniform vec2 u_scale;
uniform float u_point_size = 5.0;

layout(location = 0) in vec2 v_position;

vec2 from_pixel_pos(vec2 position, vec2 viewport) {
    return mix(vec2(-1.0, 1.0), vec2(1.0, -1.0), position / viewport);
}

void main() {
	gl_Position = vec4(from_pixel_pos(u_offset + v_position * u_scale, u_viewport), 0.0, 1.0);
    gl_PointSize = u_point_size;
}
