That would still leave too many variables. Suppose you and I worked the same machine, and were given the same starting materials, and were told to make the same product. We could be fairly compared. Merit pay might make sense.
But teaching is different. Suppose you taught a first period Algebra 1 class and I taught a third period Algebra 1 class. In urban schools especially, kids straggle in. Your scores would be lower simply because of absenteeism.
Now further suppose you had even one really disruptive student. That could really destroy a class!
Bottom line: My students would score better, even though you might well be the better teacher.
I suppose it would all even out over long periods of time ( maybe 10+ years). But merit pay wouldn't have much effect if you waited that long to award it.
For me, the solution is snap observations of teachers by people competent in the subject matter. Either the teacher is teaching, or he is not. Document, then fire, those who are not teaching.
Maybe a week's worth of video? I don't know, there's got to be a way to do it.
Of course, I still think that it's a pipe dream. Success breeds expectations. Most teachers - "progressive" ones in particular - don't want their peers to be successful and raise the bar. Crabs in a pot, most of them.