
uniform vec3 u_view_up;
uniform vec3 u_view_right;
uniform mat4 u_view_matrix;

in vec3 attrib_position;
in vec2 attrib_size;
in vec4 attrib_color;
in vec4 attrib_texture_info;
in int attrib_atlas;
in vec2 attrib_vert;
in vec2 attrib_uv;

out vec2 v_uv;
out vec4 v_color;
flat out vec4 v_texture_info;
flat out int v_atlas;

void main() {
    vec3 world_pos =
        attrib_position
        + u_view_right * attrib_vert.x * (attrib_size.x / 256.0)
        + u_view_up * attrib_vert.y * (attrib_size.y / 256.0);
    gl_Position = u_view_matrix * vec4(world_pos, 1.0);

    v_uv = attrib_uv;
    v_color = attrib_color;
    v_texture_info = attrib_texture_info;
    v_atlas = attrib_atlas;
}
