GLFW prevent viewport stretching

I am using GLFW, glad and glm.
I want to render a simple square, my vertices are correct, but when I render it, it gets stretched into a rectangle. (probably by the viewport)

When the aspect ratio of the window is 1:1, it renders a square, but when it’s 16:9, (1280x720) the square is turned into a rectangle.

Here I create the projection matrix and input it into the shader program:

glm::mat4 projection(1.0f);
projection = glm::perspective(glm::radians(camera.fov), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 1000.0f);
glUniformMatrix4fv(glGetUniformLocation(basicShader.ID, "projectionMatrix"), 1, GL_FALSE, glm::value_ptr(projection));

Here is the framebufferSizeCallback, which gets called every time the window is resized:

void framebufferSizeCallback(GLFWwindow *window, int width, int height)
	glViewport(0, 0, width, height);

void framebufferSizeCallback(GLFWwindow *window, int width, int height)
does not set the viewport until the window has been resized by a drag of it’s corner?
Have you tried to flip the aspect?

wild guesses

The aspect ratio will only be correct if SCR_WIDTH/SCR_HEIGHT is equal to width/height. IOW, the projection matrix must be generated based upon the actual width and height of the window (ideally, these should be the physical dimensions; pixels aren’t necessarily square).

So now even with the 1:1 aspect ratio (600x600), I get a rectangle. Is this the model matrix’s fault then?

nvm i fixed it, i had my vertices wrong, and i didn’t even notice