To simplify matters let us ignore the weight of the body.
In this case the barbell must be placed directly over the pressure point of the groundforces on the foot.
The groundforces are in fact distributed over the feet with varying pressure (red: high pressure):

However in a mechanical analysis these distributed forces may be replaced by a single force applied in the pressure weighted centre of the foot (black in figure): the pressure point.
Further let us model the lower leg as a fixed rod, T, and the upper leg as a fixed rod, F.
Let us model the knee extensors as an electrical engine placed inside the knee opening up the knee angle with a moment Mk and the hip extensors as an electrical engine placed inside the hip opening up the hip angle with a moment Mh:

First let us analyze the moments working on the knee.
Considering the static case the sum of these must be 0.
Which means that:
Mk = Fg * dk + Fb * dk
But in the static case Fg = Fb = F =>
Mk = 2 * F * dk
Next let us analyze the moments working on the hip.
Considering the static case the sum of these must be 0.
Which means that:
Mh = 2 * F * dh
As we see from these equations:
the hip moment is proportional to the horizontal distance from the
hip to the pressure point on the foot
the knee moment is proportional to the horizontal distance from the knee to the pressure point on the foot
And the pressure point on the foot is roughly midfoot.
The above is a first order approximation.
The hamstrings cross both the hip and the knee.
They therefore produce both hip extension torque and knee flexion torque.
Likewise the rectus femoris cross both the knee and the hip.
They therefore produce both knee extension torque and hip flexion torque.
However due to where the insertions are placed when the hamstrings contract, the amount of hip extension torque they produce is considerably greater than the amount of knee flexion torque they produce. The opposite is true for the rectus femoris: It produces much more knee extension torque than hip flexion torque. (1)
(1) Squats Are Not Hip Dominant Or Knee Dominant.