edit 20:18, there is a counterexample posted by @ILoveCoding
My intuition says this will work. I can not prove it, because I'm not advanced enough. However, I cannot come up with any counterexample. I will try to describe the solution and publish the code, please correct me if my solution is not true.
First we load the input into the array. Then we create a second array of the same size and for each possible placement of a 2x2 square, we mark 1 in the second array. For the example published by OP, it will look below.
0 1 0 0 1 1 1 0 0 0 0 0
Then, for each 1 in the second array, we calculate the number of neighbors (including diagonals) + 1 (because if it does not have any neighbors, we should see it as 1). We set these new numbers to an array. Now it should look like this.
0 4 0 0 3 4 3 0 0 0 0 0
Then, for each nonzero value in the array, we check to see if it has any neighbor with a greater or equal value. If he will move on, because he cannot be in a decision. If we do not find such a value, then it will be in the solution. We must reset to zero each neighbor of the original value (because it cannot be in the solution, it will overlap the solution.
So, the first number found should be 2 on the left. After processing, the array should look like this.
0 0 0 0 3 0 3 0 0 0 0 0
When we check that the other situation is the same.
As a result, we get non-zero values ββin the array indicating where the upper left corners of 2x2 squares are located.
If you want the number of them to just cross the array and count non-zero elements.
Another example
1111 -> 1 1 1 0 -> 4 6 4 0 -> 4 0 4 0 1111 -> 1 1 1 0 -> 6 9 6 0 -> 0 0 0 0 1111 -> 1 1 1 0 -> 6 9 6 0 -> 6 0 6 0 1111 -> 1 1 1 0 -> 6 9 6 0 -> 0 0 0 0 1111 -> 1 1 1 0 -> 4 6 4 0 -> 4 0 4 0 1111 -> 0 0 0 0 -> 0 0 0 0 -> 0 0 0 0
The code I'm writing can be found here http://ideone.com/Wq1xRo