I am trying to figure out what actual operation is going on here to transform this 2x4 matrix with this 3x3 into a new 2x4. I'm from a computer science background so don't know anything about matrices beyond the very basics. Could someone pretty please explain me like I'm 5. I need to program a function to give this type of output based on the input of two such matrices / arrays. Can someone please help me understand the formula so I can write my program?
Example data
Input 1 (3x3) matrix
[0.4709243769447963, -0.1089570231317744, 289.4386175367417;
-0.05915378097999304, 0.3816064687798928, 503.5397702666958;
-9.054861751225341e-05, -0.0001637295648326533, 1]
Input 2 (2x4) matrix
[0, 0] [1000, 0] [1000, 740] [0, 740]
Desired output
[289.439, 503.54] [836.068, 488.631] [862.289, 921.962] [237.598, 894.279]
Details of the function

Input #1 is fine, let's call it $A$.
We need to append a row of ${\large\tt1}$s to input #2 (let's call it $B$) so that we can form the product
$$P = A\pmatrix{B\\{\large\tt1}^T}$$ NB: If we don't append this row, then the dimensions aren't compatible.
Then we need to take the third row of the product, $r^T=e_3^TP$ and form a matrix by taking the outer product with a column vector of ${\large\tt1}$s $$Q = {\large\tt1}r^T = {\large\tt1}e_3^TP = {\large\tt1}e_3^TA\pmatrix{B\\{\large\tt1}^T}$$ NB: The row vector $e_3^T$ is the last row of the $3\times 3$ identity matrix.
Now perform element-wise division of $P$ by $Q$. $$R = P\oslash Q = \pmatrix{C\\{\large\tt1}^T}$$ The desired output is the $C$ sub-matrix.