There are multiple trajectory angles and launch velocities that can be given to a projectile to get it to land in a certain position. If you make the velocity a constant then you can solve for the angle, if you make the launch angle constant then you can solve for the velocity. Physiscs Stack Exchange
gives the answer - you need to solve two simultaneous equations, one for a constant velocity movement in the x direction and one for the gravity influenced up and down motion in the y direction (solve by assuming the time for each movement is the same). If you have two variables (angle and velocity) then you cannot solve it. If the start and end points are at different y values then y (or, rather, delta y) is not zero - the equation will still work.
If you apply your answer to the physics behavior then these equations do not account for linear damping, so they will make inaccurate predictions if you have linear damping set to above zero.