title: UE4 - How to scale a texture or material given 4 screen coordinates?
body: <p>I am trying to replicate the portal shown in this video: <a href="https://youtu.be/_SmPR5mvH7w?t=245" rel="nofollow noreferrer">https://youtu.be/_SmPR5mvH7w?t=245</a>.</p>
  <p>And more specifically the implementation of the concept: <em>&quot;What our portal camera currently sees is this, but what our camera actually should see is this&quot;</em></p>
  <p>Right now I have a SceneCaptureComponent2D that renders to a Render Target which is hooked up to the material shown in the image below.</p>
  <p><a href="https://i.stack.imgur.com/05nkJ.png" rel="nofollow noreferrer">Link to image showing my material.</a></p>
  <p>The white square with the four red corners shown in the image is the back side of the portal (currently visible for debugging reasons).</p>
  <p>What I want to do is to take that white square and scale it up to cover the entire material. Given the screen coordinates of those red corners. Is there a way to scale the image such that those corners is now placed in coordinates (0,0), (0,1), (1,0) and (1,1) of the material or texture?</p>
  <p>The CapureComponent moves around the sceen in relation to the player so this needs to be done in runtime and account for viewing the white square at an angle, making the coordinates diagonal in relation to each other. I've tried previously with changing the material UV and multiply an offset so that I kind of zero in on the white square, but did not manage to make it diagonal to fit only the square when viewed at an angle.</p>
  <p>Do I change the camera, the texture or the material? Any help is appreciated!</p>