Convert local point in RectTransform to screen space

I need to convert a point in a RectTransform to screen space. Basically, I need to do the opposite of what RectTransformUtility.ScreenPointToLocalPointInRectangle does. I have looked at Transform.TransformPoint, except that I need points converted to screen space, not world space.

As an example, the point (0.5, 0.5) in the local space of a RectTransform should get converted to the screen space coordinates of the center of the RectTransform.

How can I accomplish this?

use GetWorldCorners() or Transform.TransformPoint() and then use RectTransformUtility.WorldToScreenPoint().

    Vector3[] corners = new Vector3[4];

    Debug.Log("Screen point1: " + new Vector3(rect.rect.xMax, rect.rect.yMin, 0) + rect.position);
    foreach (Vector3 corner in corners) {
        Debug.Log("World point: " + corner);
        Debug.Log("Screen point: " + RectTransformUtility.WorldToScreenPoint(null, corner));
        Debug.Log("Viewport: " + Camera.main.ScreenToViewportPoint(corner));

You should be able to use Transform.TransformPoint to convert from local space to world space, then use Camera.WorldToScreenPoint to convert to the screen point of the given camera.