What is going wrong in your code is in this part
imgcoor[0] = p2.X;
imgcoor[1] = p2.Y;
imgcoor[2] = p2.X;
imgcoor[3] = p2.Y;
You are using p2 twice, so you are getting it back twice.
Possibly it should be
imgcoor[0] = p1.X;
imgcoor[1] = p1.Y;
imgcoor[2] = p2.X;
imgcoor[3] = p2.Y;
imgcoor[0] = p2.X;
imgcoor[1] = p2.Y;
imgcoor[2] = p3.X;
imgcoor[3] = p3.Y;
or similar.
However, like others, I feel you are not using the best methodology. Still, press on, and once you get a feel for what's happening you might see a better way.
Good luck! :)