Explain this things only - ScreenPointToLocalPointInRectangle, localPoint, minimapRect.rect, minimapRect.rect.x.
Vector2 mousePos = Mouse.current.position.ReadValue();
if(!RectTransformUtility.ScreenPointToLocalPointInRectangle
(minimapRect, mousePos, null, out Vector2 localPoint )) { return; }
Vector2 lerp = new Vector2(
(localPoint.x - minimapRect.rect.x) / minimapRect.rect.width,
(localPoint.y - minimapRect.rect.y) / minimapRect.rect.height);
Vector3 newCameraPos = new Vector3(
Mathf.Lerp(-mapScale, mapScale, lerp.x),
playerCameraTransform.position.y,
Mathf.Lerp(-mapScale, mapScale, lerp.y));