In the figure below, this frame is showed in the dashed rectangle with inactive pixels surrounding it. Inactive pixels include a 1-pixel-wide back porch, a 2-pixel-wide front porch, 1 line before the first active line, and 1 line after the last active line. Both active and inactive ...
One further Question though. Is it possible to drag the lines? With your solution it is possible to change the rectangle by clicking a certain coordinate. It would be more convenient for the user to just click the existing line and drag it.