An efficient squatter mainly uses the glutes to extend the hips, not the hamstrings.
As can be seen from this image the hamstrings crosses both the hip and knee joint:
They therefore have two functions: extending the hips and flexing the knee. If you use the hamstrings to extend the hips in the squat you also get a flexing torque at the knee. This means that the quads have to work even harder.(1)
As can be seen from this image the gluteus maximus crosses the hip joint and also extends the hip (as well as externally rotates the femur):
In the squat we can vary the ankle, knee and back angle. In order to stay balanced the bar must stay over midfoot. So we have 1 equation and 3 variables, which mean 2 degrees of freedom. So we have a choice to make; do we want to minimize or maximize the moment around the knee (or somewhere in between). The first leads to a hip dominant squat:
The second leads to a knee dominant squat:
The moment around the knee is proportional to the horizontal distance from the bar to the knee and the moment around the hip is proportional to the horizontal distance from the hip to the bar.
In the knee dominant squat the quads are clearly the limiting factor and we want to avoid using the hamstrings.
In the hip dominant squat the quads are less of a limiting factor and the hamstrings can be used to a larger extent.
I think it may be a problem for some people that their glutes are very weak, in which case they will tend to also use the hamstrings even when this is inefficient.
If this is the case one should focus on taking a wide stance and hitting full depth (2). The wide stance causes an inward rotational force on the femur from the bar which the gluteus maximus have to counter. In the bottom position of the squat the knee is flexed which results in less tension in the hamstrings. It is therefore difficult for the hamstrings to contribute to hip extension and the glutes will contribute more.
(1) Hamstrings–The Most Overrated Muscle Group for the Squat
(2) Squats Don’t Work Your Glutes (Because You’re Squatting Wrong)