These can both be sampled without rejection using transformed uniform variates.
Rectangle:
set.seed(94)
u <- runif(1.5e4, max = 3)
v <- runif(1.5e4, max = 2)
x <- u + v - 10
y <- v - u + 8
# sanity check
range(x + y)
#[1] -1.999774 1.999826
range(x - y + 15)
#[1] -2.999646 2.999692
plot(x, y)

Ellipse (see Algorithm: Calculate pseudo-random point inside an ellipse):
phi <- runif(1e4, max = 2*pi)
rho <- sqrt(runif(1e4))
x <- sqrt(5)*rho*cos(phi) + 6
y <- sqrt(10/3)*rho*sin(phi) + 4
# sanity check
range(2*(x - 6)^2 + 3*(y - 4)^2)
#[1] 0.001536582 9.999425234
plot(x, y)

Update with derivation:
Rectangle:
The rectangle is bounded by the lines:
y = -2 - x
y = 2 - x
y = x + 12
y = x + 18
The left-most point of the rectangle is found by point where the first and last lines intersect (-10, 8).
The dimensions of the rectangle are 3*sqrt(2) and 2*sqrt(2), so sample from a rectangle with these dimensions:
u = 3*sqrt(2)*U1
v = 2*sqrt(2)*U2
where U1 and U2 are standard uniform random variates (i.e., runif).
Since the slopes of the bounding lines are -1 and 1, we can think of the rectangle as being rotated -90° about the origin axes. Rotate u and v by -90° to orient the rectangle containing (u, v) to be in the same direction as the desired rectangle:
x = u*cos(-90°) - v*sin(-90°) = sqrt(2)*(u + v)/2 = 3*U1 - 2*U2
y = v*cos(-90°) + u*sin(-90°) = sqrt(2)*(v - u)/2 = 3*U1 + 2*U2
The left-most point of (x, y) is still at the origin, so translate the points by (-10, 8) to match the desired rectangle:
x = 3*U1 - 2*U2 - 10
y = 3*U1 + 2*U2 + 8
Ellipse:
The x - 6 and y - 4 mean your ellipse is centered at (6, 4).
Center the ellipse at the origin by ignoring the 6 and 4, then write the equation for the ellipse in standard form:
x^2/a^2 + y^2/b^2 = 1
a = sqrt(5)
b = sqrt(10/3)
a and b are the dimensions of your ellipse.