Teleport RigidBody with offsets

Hi,
I struggle at teleporting a RigidBody and respect the offsets in position and rotation between portal and RB. See this drawing.

I am entering portal A at the red dot in the red arrows direction.
Expected: Leaving at portal B with the red arrows direction at red arrows position.
Actual: Exiting at the blue dot with the blue direction.

Below is my script, which I worked together with some google help and YouTube tutorials but seems like I got lost somewhere and I can’t figure out how to set the offsets correctly. Where is the fault in here?

Vector3 portalToObject;
Vector3 rbVel;
Vector3 rbVelAng;
Quaternion quatDiff;
public void Teleport(GameObject objectToTeleport)
{
    portalToObject = portalA.position - objectToTeleport.transform.position;
    quatDiff = Quaternion.Inverse(objectToTeleport.transform.rotation) * portalA.transform.rotation;

    rb = objectToTeleport.GetComponent<Rigidbody>();

    rbVel = rb.velocity;
    rbVelAng = rb.angularVelocity;
    rb.isKinematic = true;

    rb.MoveRotation(portalB.rotation * quatDiff);
    rb.position = portalB.position + portalToObject;

    rb.isKinematic = false;
    rb.velocity = rbVel;
    rb.angularVelocity = rbVelAng;
}

I am probably doing something wrong with the rigidbody velocity stuff, but I can’t even get the position and rotation right after the teleport and am kinda lost now…

Figured it out myself. It’s probably not the best way but basically I set the object to teleport a child of portal A, noting the local position and rotation, then setting the object to teleport a child of portal B, applying the local position and rotation and unchild the object. It works pretty neat:

Rigidbody rb = null;

Vector3 portalToObject;
float rbVel;
Quaternion quatDiff;

public void Teleport(GameObject objectToTeleport)
{
    objectToTeleport.transform.parent = portalB;

    portalToObject = objectToTeleport.transform.localPosition;
    quatDiff = objectToTeleport.transform.localRotation;
    quatDiff = Quaternion.Euler(quatDiff.eulerAngles.x, quatDiff.eulerAngles.y + 180f, quatDiff.eulerAngles.z);
    rb = objectToTeleport.GetComponent<Rigidbody>();

    rbVel = rb.velocity.magnitude;
    rb.isKinematic = true;

    objectToTeleport.transform.parent = portalB;
    objectToTeleport.transform.localPosition = portalToObject;
    objectToTeleport.transform.localRotation = quatDiff;
    objectToTeleport.transform.parent = null;

    rb.isKinematic = false;
    rb.velocity = rbVel * portalB.forward;
}