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);
}

maybe
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).