If I have 4 points
var x1;
var y1;
var x2;
var y2;
var x3;
var y3;
var x4;
var y4;
that make up a box. So
(x1,y1) is top left
(x2,y2) is top right
(x3,y3) is bottom left
(x4,y4) is bottom right
And then each point has a weight ranging from $0-522$. How can I calculate a coordinate $(tx,ty)$ that lies inside the box, where the point is closer to the the place that has the least weight (but taking all weights into account). So for example. if $(x3,y3)$ has weight $0$, and the others have weight $522$, the $(tx,ty)$ should be $(x3,y3)$. If then $(x2,y2)$ had weight like $400$, then $(tx,ty)$ should be move a little closer towards $(x2,y2)$ from $(x3,y3)$.
Does anyone know if there is a formula for this? Thanks