Do you talk about a 2D/CanvasItem shader or a 3D/Spatial shader? Your question would make less sense for a 3D Shader IMHO but who knows. In that case I'd try to get a 3D aabb of the meshinstance then transfer that via camera.unproject_position into screen coords and get the rect of the min/max of the 4 values (works for a cube, might be a bit too big for other shapes). Then pass the result via a uniform to the shader. But perhaps I'm thinking too complicated.
Thank you very much, it helped me a lot. I am trying to implement a fixed-view 3D game demo, and it is an orthogonal camera. According to your method, I only need to get aabb once when the camera is at the origin; then in the fragment shader, calculate the final aabb by camera position.