The “right” method depends on what it is that you’re ultimately trying to do. Two reasonable interpretations are that you want to map the unit square onto this trapezoid or that you’re going to make a uniform grid on the trapezoid by straight linear interpolation in both directions and then perhaps map that back to the unit square.
The barycentric method that you’ve found in this answer is a good technique. Another approach is to compute the planar perspective transformation that maps between the unit square and trapezoid and use that to map points. That’s a commonly-available graphic library function, but if you’re doing it yourself you can find descriptions of the process with a web search, and briefly described in this answer.
If the parallel sides of the trapezoid are parallel to the $x$-axis, this transformation matrix is fairly simple. Let the lower-left corner be at the origin, the bottom and top widths be $w_b$ and $w_t$, respectively, and the top left corner be at $(x_t,h)$. Then, if you work through the calculation in the second link, above, many of the terms vanish and you’re left with $$A=\pmatrix{w_b&{w_b\over w_t}x_t&0\\0&{w_b\over w_t}h&0\\0&{w_b-w_t\over w_t}&1}$$ for the matrix that maps the unit square onto the trapeziod, which translates into the mapping $$(x,y)\mapsto\left({w_b\over (1-y)w_t+yw_b}(w_tx+x_ty),{w_b\over(1-y)w_t+yw_b}hy\right).\tag{*}$$ This looks plausible: the denominator interpolates linearly between the top and bottom widths and depends only on $y$. The resulting $y$-coordinate doesn’t depend on $x$, either. For a fixed $y$, the $x$-coordinates in the trapezoid are offset proportionally to the transformed $y$-coordinate and are uniformly scaled by the width of the trapezoid at that height. You’ll end up with a grid that looks something like this:

Mapping to a trapezoid that has its lower-left corner at an arbitrary point $(x_b,y_b)$ is a matter of translating after performing the mapping of the previous paragraph, which in matrix terms amounts to filling in the last column of $A$ with those lower-left corner coordinates.
Going in the other direction, you can define a “uniform” grid on the trapezoid via $$\begin{align}u &= \left(x-\frac{x_t}hy\right)/w_y\\v &= y/h\end{align}$$ where $w_y$ is the width of the trapezoid at height $y$, i.e., $w_y=(1-y)w_b+yw_t$. This is similar to the previous grid, but this one is also evenly spaced in the $y$ direction. If you then need to map this back to a unit square for some reason, compute $A^{-1}$, which isn’t too hard given $A$’s relatively simple structure. For an arbitrarily-located trapezoid, simply translate first, i.e., subtract the coordinates of the lower-left corner from $x$ and $y$ before computing $u$ and $v$.
If the trapezoid isn’t aligned with a coordinate axis, then another way to tackle this is to translate and rotate so that it’s in “standard” position, as above, but I think computing the perspective transform matrix $A$ directly isn’t going to be any more work in that case.
http://stackoverflow.com/questions/41487380/obtain-two-dimensional-linear-space-on-trapezoid-shape-inside-image-frame
– Pedro Batista Jan 05 '17 at 14:21http://math.stackexchange.com/questions/13404/mapping-irregular-quadrilateral-to-a-rectangle
– Pedro Batista Jan 05 '17 at 16:42