I am trying to find out how to calculate a solid angle of a square or a rectangle in space, in a situation where

* we know *θ* and *ϕ*, being *θ* the polar angle and *ϕ* the azimutal angle
* the sphere has radius *r* = 1
* the plane's minimum distance from the center of the sphere is equal to *r*, thus 1. In other terms the plane is tangent to the sphere.
* we also know *θ* and *ϕ* at the edges as they both vary from -֔π/4 to ֔π/4. This is a consequence of the plane simply being one face of a cube that includes the sphere.
* the zero of both angles *θ* and *ϕ* coincides with the center of the plane.

In alternative words this problem could be described as finding the solid angle, using known azimutal polar angles, for every pixel of an image that is ideally placed at distance one from the sphere.

[![How do we find the solid angle of the two white quads?](https://i.stack.imgur.com/g4app.png)](https://i.stack.imgur.com/g4app.png)

What is a general formula to find the solid angle of any quad placed on the plane?

Edit: as someone asked what software I used to produce the sketch, it’s Blender 2.76.