so with perspective cameras, its very simple:
CameraMatrices matrices = world.GetComponent<CameraMatrices>(cameraEntity);
Vector2 screenPoint = new(0.5f, 0.5f);
(Vector3 origin, Vector3 direction) ray = matrices.GetRayFromScreenPoint(screenPoint);
and i havent tested this with orthographic cameras recently. last time i tried it didnt work.