docs: function calculateMatrixAndOffset({
    // UNCHANGED
    viewport,
    // NEW PARAMS
    coordinateSystem,
    coordinateOrigin,
    coordinateZoom
  }) {
    const {viewMatrixUncentered} = viewport;
    let {viewMatrix} = viewport;
    const {projectionMatrix} = viewport;
    let {viewProjectionMatrix} = viewport;
  
    let projectionCenter;
    let cameraPos = viewport.cameraPosition;
    let shaderCoordinateSystem = getShaderCoordinateSystem(coordinateSystem);
    let shaderCoordinateOrigin = coordinateOrigin;
  
    if (shaderCoordinateSystem === PROJECT_COORDINATE_SYSTEM.LNGLAT_AUTO_OFFSET) {
      if (coordinateZoom < LNGLAT_AUTO_OFFSET_ZOOM_THRESHOLD) {
        // Use LNG_LAT projection if not zooming
        shaderCoordinateSystem = PROJECT_COORDINATE_SYSTEM.LNG_LAT;
      } else {
        // Use LNGLAT_AUTO_OFFSET
        const lng = Math.fround(viewport.longitude);
        const lat = Math.fround(viewport.latitude);
        shaderCoordinateOrigin = [lng, lat];
      }
    }
  
    switch (shaderCoordinateSystem) {
      case PROJECT_COORDINATE_SYSTEM.IDENTITY:
      case PROJECT_COORDINATE_SYSTEM.LNG_LAT:
        projectionCenter = ZERO_VECTOR;
        break;
  
      // TODO: make lighting work for meter offset mode
      case PROJECT_COORDINATE_SYSTEM.LNGLAT_OFFSETS:
      case PROJECT_COORDINATE_SYSTEM.METER_OFFSETS:
      case PROJECT_COORDINATE_SYSTEM.LNGLAT_AUTO_OFFSET:
        // Calculate transformed projectionCenter (using 64 bit precision JS)
        // This is the key to offset mode precision
        // (avoids doing this addition in 32 bit precision in GLSL)
        const positionPixels = viewport.projectFlat(
          shaderCoordinateOrigin,
          Math.pow(2, coordinateZoom)
        );
  
        cameraPos = [
          cameraPos[0] - positionPixels[0],
          cameraPos[1] - positionPixels[1],
          cameraPos[2]
        ];
  
        // projectionCenter = new Matrix4(viewProjectionMatrix)
        //   .transformVector([positionPixels[0], positionPixels[1], 0.0, 1.0]);
        projectionCenter = vec4.transformMat4(
          [],
          [positionPixels[0], positionPixels[1], 0.0, 1.0],
          viewProjectionMatrix
        );
  
        // Always apply uncentered projection matrix if available (shader adds center)
        viewMatrix = viewMatrixUncentered || viewMatrix;
  
        // Zero out 4th coordinate ("after" model matrix) - avoids further translations
        // viewMatrix = new Matrix4(viewMatrixUncentered || viewMatrix)
        //   .multiplyRight(VECTOR_TO_POINT_MATRIX);
        viewProjectionMatrix = mat4.multiply([], projectionMatrix, viewMatrix);
        viewProjectionMatrix = mat4.multiply([], viewProjectionMatrix, VECTOR_TO_POINT_MATRIX);
        break;
  
      default:
        throw new Error('Unknown projection mode');
    }
  
    return {
      viewMatrix,
      viewProjectionMatrix,
      projectionCenter,
      cameraPos,
      shaderCoordinateSystem,
      shaderCoordinateOrigin
    };
  }