system
Given the following post, respond as if you're commenting on Reddit:
human
How do we know a single quark's mass if quarks don't exist as individual particles?

A proton's mass is 900-something MeV

A pion's mass is about 140.

And "Single" up and down quarks have masses of 2 and 4 MeV.

Wikipedia says that the rest of the energy comes from gluon interaction, at least in case of baryons. I can't seem to find the info whether mesons are too bound by gluons, but I assume it is so.

How did we figure how much mass is attributed to the quark itself and how much - to their binding energy? Did we just calculate the binding energy somehow and then substracted it from the total mass, or is it something more complicated?

Again, if a quark can't exist as a single particle, then what exactly is its "mass"? 

Apologies if I'm misunderstanding anything.
gpt
For the light quarks, one can use chiral perturbation theory to relate the mass of the light hadrons to the mass of the light quarks. These two links give details and caveats of the procedures, as well as the most precise determinations.