attribute vec2 a_position; attribute vec4 a_color; uniform mat3 u_matrix; varying vec4 v_color; const float bias = 255.0 / 254.0; void main() { // Scale from [[-1 1] [-1 1]] to the container: gl_Position = vec4( (u_matrix * vec3(a_position, 1)).xy, 0, 1 ); // Extract the color: v_color = a_color; v_color.a *= bias; }