I have a geometry shader that extrudes lines to rectangles in 2d (by outputting triangle strips). When the lines are not parallel to the X or Y axis, I'm getting parallelograms instead. Also, when the line is parallel to the X axis, it appears thinner.
Here's what my result looks like, drawing 4 lines at different angles:

Here's the geometry shader:
#version 150 core
layout(lines) in;
layout(triangle_strip, max_vertices = 4) out;
in vec3 Color[];
smooth out vec3 FColor;
void main() {
vec3 g1 = gl_in[0].gl_Position.xyz;
vec3 g2 = gl_in[1].gl_Position.xyz;
vec3 v1 = normalize(g1 - g2) * 0.1;
vec3 v2 = normalize(g2 - g1) * 0.1;
FColor = Color[0];
gl_Position = vec4(-v2.y + g1.x, v2.x + g1.y, 0.0, 1.0);
EmitVertex();
FColor = Color[0];
gl_Position = vec4(v1.y + g2.x, -v1.x + g2.y, 0.0, 1.0);
EmitVertex();
FColor = Color[0];
gl_Position = vec4(v2.y + g1.x, -v2.x + g1.y, 0.0, 1.0);
EmitVertex();
FColor = Color[0];
gl_Position = vec4(-v1.y + g2.x, v1.x + g2.y, 0.0, 1.0);
EmitVertex();
EndPrimitive();
}
To test out the calculation, I ran the same set of vertices through the same calculation in GLM, took the results times 10.0 and plotted them using a web tool. Here's what I got:

So it looks to me like the basic calculation is correct. Can anyone help me understand what I'm doing wrong?