how to unwrap a mesh made in front of the texture
Try unwrapping with U>Project from view while in the view with the background image.

Then use S (scale), R (rotate), and G (grab/translate) to manipulate the entire UV layout (you can toggle selecting it with A).

If you want to unwrap it exactly how it appears in the viewport:


Set the render resolution to the resolution of the image/texture
Wit the camera selected, set it to be Orthographic in Properties > Object data > Lens (you can add another camera with ShiftA and make it active with CtrlNumpad 0 if you don't want to disturb the existing one)
Position the camera and tweak the Orthographic scale, again in Properties > Object Data > Lens. With the background image allowed to display in camera view, you can line it up based on how you want the image to project on your mesh.
Select your object and enter edit mode (Tab), then press U>Project from view (still in camera view).