The library I'm using for displaying interactive maps, reports the visible region in the following form:
latitudespecifies north-south position on the Earth of the point at the center of the screenlongitudespecifies east-west position on the Earth of the point at the center of the screenlatitudeDeltaspecifies north-south span of the visisble arealongitudeDeltaspecifies east-west span of the visisble area
Map is rendered using Mercator projection. I would like to use this information to find coordinates of the edges of visisble area.
The problem
Finding boundaries for longitude is simple:
$$ lonEast, lonWest = lon \pm \frac{lonD}{2} $$
For latitudes it's not as simple. Here's the function y(φ) for the Mercator projection:
$$ f(φ) = ln(tan(\frac{φ}{2} + \frac{\pi}{4})) $$
In relation to the screen, the edges remain equally spaced from the central point. This will not be true in geographical coordinates, unless central point belongs to the equator.
Here's a graph of the above function to help illustrate the point:
With latitude and latitudeDelta known, how do I figure out latSouth, latNorth?
Edit:
I think it comes down to solving:
$$ f(latS) + f(latS + latD) = 2f(lat) $$
$$ f(φ) = ln(tan(\frac{φ}{2} + \frac{\pi}{4})) $$
Which expands to:
$$ ln(tan(\frac{latS}{2} + \frac{\pi}{4})) + ln(tan(\frac{latS + latD}{2} + \frac{\pi}{4})) = 2 * ln(tan(\frac{lat}{2} + \frac{\pi}{4})) $$

Let $g$ be the inverse function of $f$, then
$$f \left({\varphi}\right) = v \Leftrightarrow \tan \left(\frac{{\varphi}}{2}+\frac{{\pi}}{4}\right) = {e}^{v} \Leftrightarrow \frac{{\varphi}}{2}+\frac{{\pi}}{4} = \arctan \left({e}^{v}\right) \Leftrightarrow {\varphi} = \boxed{g \left(v\right) = 2 \arctan \left({e}^{v}\right)-\frac{{\pi}}{2}}$$
If ${\varphi}$ is the latitude, let $\boxed{v = f \left({\varphi}\right)}$, one has ${{\varphi}}_{S} = g \left(v-h\right)$ and ${{\varphi}}_{N} = g \left(v+h\right)$ for some $h$.
Let ${\Delta} = {{\varphi}}_{N}-{{\varphi}}_{S}$, one has
$${\Delta} = g \left(v+h\right)-g \left(v-h\right) = 2 \arctan \left({e}^{v+h}\right)-2 \arctan \left({e}^{v-h}\right)$$
Using the well known formula $\tan \left(a-b\right) = \frac{\tan \left(a\right)-\tan \left(b\right)}{1+\tan \left(a\right) \tan \left(b\right)}$, it gives
$$\tan \left(\frac{{\Delta}}{2}\right) = \frac{{e}^{v+h}-{e}^{v-h}}{1+{e}^{v+h} {e}^{v-h}} = \frac{{e}^{h}-{e}^{{-h}}}{{e}^{{-v}}+{e}^{v}} = \frac{\sinh \left(h\right)}{\cosh \left(v\right)}$$
Let now $\boxed{u = \cosh \left(v\right) \tan \left(\frac{{\Delta}}{2}\right)}$, one has
$$\sinh \left(h\right) = u \Leftrightarrow \boxed{h = \text{argsinh} \left(u\right) = \ln \left(u+\sqrt{1+{u}^{2}}\right)}$$
One can now compute the south and north latitudes ${{\varphi}}_{S}$ and ${{\varphi}}_{N}$. The use of exponential and logarithms can be completely eliminated by setting
$$t = \tan \left(\frac{{\varphi}}{2}+\frac{{\pi}}{4}\right)$$
then one has
$$u = \frac{1}{2} \left(t+\frac{1}{t}\right) \tan \left(\frac{{\Delta}}{2}\right)$$
$${{\varphi}}_{S} = 2 \arctan \left(\frac{t}{u+\sqrt{1+{u}^{2}}}\right)-\frac{{\pi}}{2}$$
$${{\varphi}}_{N} = 2 \arctan \left(t \left(u+\sqrt{1+{u}^{2}}\right)\right)-\frac{{\pi}}{2}$$