Squats work the quadraspecs - why ? because the quadraspecs do hip flexion - but when we go up is when we do the extension of the hip and thats when we work against gravity and pull all the weight - same question about climbing stairs

The quadriceps' main function is knee extension, so any time you straighten your leg you will be working them (so climbing stairs, squatting, even deadlifts to a lesser extent) One of the 4 heads of the quadriceps doe flex the hip, but only as a secondary function.

The hamstrings extend the hip, but they are bi-articulate; if your knee is flexed they don't have enough "purchase" to work properly, so some styles of squat don't use the hamstring much.