I'm trying to make a square appear on my terrain. The square is moved by the mouse but is always snapped to the grid on the terrain which is basically. The corners of the square are the terrains vertices. Really would appreciate any help.

Here is what I got so far and as I predicted it was completely wrong:
Code:
void player_gui(){
	VECTOR target_vertice;
	target_vertice.x = mouse_pos.x;
	target_vertice.y = mouse_pos.y;
	target_vertice.z = 200;
	//CURSOR
	vec_for_screen(target_vertice,camera);
	draw_line3d(target_vertice,vector(0,0,100),100);
	draw_line3d(target_vertice.x + 3,vector(0,0,100),100);
}



boolean my.awesomeness = so true;