Apply convolution theorem:
$$
|A||B|\ \mathrm{sinc}(A\omega/2) \ \mathrm{sinc}(B\omega/2)
$$
WA gives for $\mathcal{F}^{-1}$, disregarding constants,
$$
\begin{align}
&& (A + B - 2t) \ \mathrm{sgn}(A + B - 2t) & - (A - B + 2t)\ \mathrm{sgn}(A/2 - B/2 + t) + \\
&& (A - B - 2t)\ \mathrm{sgn}(-A/2 + B/2 + t) & + (A + B + 2t)\ \mathrm{sgn}(A/2 + B/2 + t)
\end{align}
$$
With constants, we multiply all above by
$$
\frac{|A||B|}{4AB} = \frac{1}{4}\mathrm{sgn}(AB)
$$
Plotted in desmos. This is the primary solution.
Validating
Comparing sampling the function against FFT convolution:
def formula(t, A, B):
s = lambda x: np.sign(x)
p, m = A + B, A - B
o0 = (p - 2*t)*s(p - 2*t) - (m + 2*t)*s(m/2 + t)
o1 = (m - 2*t)*s(-m/2 + t) + (p + 2*t)*s(p/2 + t)
return (o0 + o1) * (1/4)*s(A*B)
Now for discrete and comparing:
N, A, B = 4096, 10, 4
t = np.linspace(-A*B, A*B, N, 0) # span long enough interval, A*B
boxcar = lambda A: ((t >= -A/2) * (t <= A/2)).astype(int)
x0, x1 = boxcar(A), boxcar(B)
o_fftconv = fft_conv_and_center(x0, x1) * abs(2 * A * B) / N
o_formula = out(t, A, B)
Full code -- we also need to scale the discrete result by $2|AB|/N$, and have a sufficiently high $N$ (something with bandlimiting maybe?). Result:

Good enough for me.
Time-domain derivation
Did this first but then scrapped because the expression in terms of $A, B$ is too complicated. This isn't the primary solution, only an alt demo.
Total support is $T=A + B$, of which the flattop part is $T_\text{top}=\max(A, B) - \min(A, B)$, all centered at $x= c = a + b$ (if we did $\Pi(t/A - a) ...$), and let $T_\text{ramp} = T - T_\text{top}$. We have
which is, and let us define "ramp flat ramp",
$$
\begin{align}
RFR^{*}(T, T_\text{top}, T_\text{ramp}, c) = \
& r(t - (c - T/2))\ - \\
& r(t - (c - T/2 + T_\text{ramp}/2))\ - \\
& r(t - (c - T/2 + T_\text{ramp}/2 + T_\text{top}))\ + \\
& r(t - (c - T/2 + T_\text{ramp} + T_\text{top}))
\end{align}
$$
and
$$
\begin{align}
RFR(A, B, a, b) =
RFR^{*}(
& A + B, \max(A, B) - \min(A, B), \\
& A + B - \max(A, B) + \min(A, B), a + b
)
\end{align}
$$
Then flattop's value (hence output max) is
$$
\begin{align}
T_\text{ramp}/2
&= \frac{1}{2}[A + B - \max(A, B) + \min(A, B)] \\
&= \min(A, B)
\end{align}
$$
We also have $\max(A, B) - \min(A, B) = |A - B|$ (for real $A, B$), and we can simplify to
$$
RFR^{*}(A + B, |A - B|, 2 \min (A, B), a + b)
$$
NOTES:
- $A$ and $B$ are assumed to be non-negative (only in this solution)
- $*$ isn't complex conjugation (as is seen from the first invocation)
- $r(t) = (t \geq 0)$, ramp