Bug in RectInt.ClampToBounds?

So I’ve been using this one for a while now and I’ve hit a weird behavior.

The documentation says:
“Clamps the position and size of the RectInt to the given bounds.”

From this I understand a sort of intersection between two rectangles where the area of the first is clamped to fit in the area of the second.

The code for it seems to be shown like this in Rider

public void ClampToBounds(RectInt bounds)
{
  this.position = new Vector2Int(Math.Max(Math.Min(bounds.xMax, this.position.x), bounds.xMin), Math.Max(Math.Min(bounds.yMax, this.position.y), bounds.yMin));
  this.size = new Vector2Int(Math.Min(bounds.xMax - this.position.x, this.size.x), Math.Min(bounds.yMax - this.position.y, this.size.y));
}

This seems to behave like an intersection if the position/min of the first rect is contained in the second rect, but if the position/min of the first rectangle is smaller than the position/min of the second rectangle then the position gets clamped within the area, but the size seems to mostly remain the same.

Do I have a fundamental misunderstanding of how the function is supposed to work or is this a legitimate bug?